package com.sq.partner.manager.dao;

import java.util.List;
import java.util.Map;

import com.sq.partner.manager.mybatis.model.FacadeAppForm;
import com.sq.partner.manager.mybatis.model.FacadePayment;
import com.sq.partner.manager.mybatis.model.FacadeTransLog;

/**
 * 支付信息Dao接口
 * 
 * @author zhouxiuxiu
 *
 */
public interface FacadePaymentDao extends BaseDao {

    /**
     * 根据投保单号查询交易流水号
     * 
     * @param appno
     * @return
     * @throws Exception
     */
    public String findFacadeTransLogByTransNo(String appno) throws Exception;

    /**
     * 插入交易轨迹信息
     * 
     * @param appno
     * @return
     * @throws Exception
     */
    public void insertFacadeTransLog(FacadeTransLog translog) throws Exception;

    /**
     * 查询投保单表状态为支付成功或出单失败的支付及保单信息
     * 
     * @param map
     * @return
     * @throws Exception
     */
    public Map<String, Object> queryConfirmAgainMessage(Map<String, Object> map)
            throws Exception;

    /**
     * 缴费接受后更新交易记录表信息
     * 
     * @param translog
     * @throws Exception
     */
    public void updateFacadeTransLog(FacadeTransLog translog) throws Exception;

    /**
     * 更新投保单表信息
     * 
     * @param map
     * @throws Exception
     */
    public void updateFacadeAppFormByAppno(Map<String, Object> map)
            throws Exception;

    /**
     * 确认该保单号是否为最后一个缴费确认
     * 
     * @param map
     * @return
     * @throws Exception
     */
    public List<String> queryConfirmToLast(Map<String, Object> map)
            throws Exception;

    /**
     * 更新暂存单表
     * 
     * @param map
     * @throws Exception
     */
    public void updateFacadeTempPolicy(Map<String, Object> map)
            throws Exception;

    /**
     * 查询暂存单号最后一次支付记录
     * 
     * @param payid
     * @return
     * @throws Exception
     */
    public FacadePayment queryFacadePaymentByPayidTheLatestInsertTime(
            String payid) throws Exception;

    /**
     * 根据暂存单号生成支付流水号
     * 
     * @param stagNo
     * @return
     * @throws Exception
     */
    public String findFacadePaymentBystagNo(String stagNo) throws Exception;

    /**
     * 插入支付记录
     * 
     * @param payment
     * @throws Exception
     */
    public void saveFacadePayment(FacadePayment payment) throws Exception;

    /**
     * 暂存单号查询保单信息
     * 
     * @param payId
     * @return
     * @throws Exception
     */
    public List<FacadeAppForm> findFacadeAppFormByAppno(String payId)
            throws Exception;

    /**
     * 更新支付记录
     * 
     * @param payment
     * @throws Exception
     */
    public void updateFacadePayment(FacadePayment payment) throws Exception;

    /**
     * 通过暂存单号修改投保单表
     */
    public void updateFacadeAppForm(Map<String, Object> map) throws Exception;
    
    public List<FacadePayment> queryFacadePaymentByPayid(String payid)
            throws Exception;

}
